﻿Public Class xtf_LISTADOcajaconcepto_
    Public Overrides Sub IniciarLista()
        Try
            gdc_general.BeginUpdate()
            gdc_general.DataSource = dtt_DataTable
            'ulg_Lista.DisplayLayout.GroupByBox.Style = Infragistics.Win.UltraWinGrid.GroupByBoxStyle.Full

            'Creacion y carga de Cuentas
            dtt_DataTable.Columns.Add("Identificador (ID)")
            dtt_DataTable.Columns.Add("Nombre")
            dtt_DataTable.Columns.Add("Cajas")
            dtt_DataTable.Columns.Add("Solicita")
            dtt_DataTable.Columns.Add("Tipo Importe")

            gdv_general.PopulateColumns(dtt_DataTable)

            Dim obj_cajaconcepto_ As New cls_cajaconcepto_
            If obj_cajaconcepto_.CargarTodos(ObtenerRegistroEstado) Then
                For Each cajaconcepto As cls_cajaconcepto_ In obj_cajaconcepto_.Items
                    AgregarItem(cajaconcepto)
                Next
            End If
            'ulg_Lista.DataBind()

            FiltrarColumnas()
            gdc_general.EndUpdate()
        Catch ex As Exception
            'Dim frmError As New frm_ErrorManager(ex.Message)
        End Try
    End Sub

    Public Function AgregarItem(ByRef cajaconcepto As cls_cajaconcepto_) As DataRow
        Dim Row As DataRow = dtt_DataTable.NewRow
        Row("Identificador (ID)") = cajaconcepto.idcajaconcepto
        Row("Nombre") = cajaconcepto.nombre
        Row("Cajas") = cajaconcepto.tipocaja
        Row("Solicita") = EnumDescription(cajaconcepto.tipo)
        Row("Tipo Importe") = EnumDescription(cajaconcepto.tipoimporte)

        dtt_DataTable.Rows.Add(Row)
        'ulg_Lista.Rows(ulg_Lista.Rows.Count - 1).Height = 19
        Return Row
    End Function

    Public Sub ModificarItem(ByRef cajaconcepto As cls_cajaconcepto_, ByRef ulg_row As DataRow)
        ulg_row("Identificador (ID)") = cajaconcepto.idcajaconcepto
        ulg_row("Nombre") = cajaconcepto.nombre
        ulg_row("Cajas") = cajaconcepto.tipocaja
        ulg_row("Solicita") = EnumDescription(cajaconcepto.tipo)
        ulg_row("Tipo Importe") = EnumDescription(cajaconcepto.tipoimporte)
    End Sub

    Public Sub New()

        Me.Cursor = Cursors.WaitCursor
        InitializeComponent()
        PERMISONuevo = "001026002"
        PERMISOModificar = "001026003"
        PERMISOEliminar = "001026004"
        PERMISOImprimir = "001026005"
        Me.Text = lbl_modulo.Text : lbl_modulodescripcion.Text = "Listado de " & lbl_modulo.Text & "."
        IniciarLista()
        Me.Cursor = Cursors.Default

    End Sub
End Class

